﻿
namespace Indeco.G24.Windows.Forms
{
	/// <summary>
	/// abstract SanPhamDanhMuc typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class SanPhamDanhMucDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<SanPhamDanhMucDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.SanPhamDanhMuc _currentSanPhamDanhMuc = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxSanPhamDanhMucDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxSanPhamDanhMucErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxSanPhamDanhMucBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the IDSanPhamDanhMuc property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDSanPhamDanhMucDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IDSanPhamDanhMucCha property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDSanPhamDanhMucChaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ten property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTenDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Mota property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMotaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the HinhMinhHoa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxHinhMinhHoaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TrangThai property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxTrangThaiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ViTri property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxViTriDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the SoLanXem property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSoLanXemDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemChinhSua property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemChinhSuaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemCapNhat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemCapNhatDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.SanPhamDanhMuc> _SanPhamDanhMucList;
				
		/// <summary> 
		/// The list of SanPhamDanhMuc to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.SanPhamDanhMuc> SanPhamDanhMucList
		{
			get {return this._SanPhamDanhMucList;}
			set
			{
				this._SanPhamDanhMucList = value;
				this.uxSanPhamDanhMucBindingSource.DataSource = null;
				this.uxSanPhamDanhMucBindingSource.DataSource = value;
				this.uxSanPhamDanhMucDataGridView.DataSource = null;
				this.uxSanPhamDanhMucDataGridView.DataSource = this.uxSanPhamDanhMucBindingSource;				
				//this.uxSanPhamDanhMucBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxSanPhamDanhMucBindingSource_ListChanged);
				this.uxSanPhamDanhMucBindingSource.CurrentItemChanged += new System.EventHandler(OnSanPhamDanhMucBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnSanPhamDanhMucBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentSanPhamDanhMuc = uxSanPhamDanhMucBindingSource.Current as Entities.SanPhamDanhMuc;
			
			if (_currentSanPhamDanhMuc != null)
			{
				_currentSanPhamDanhMuc.Validate();
			}
			//_SanPhamDanhMuc.Validate();
			OnCurrentEntityChanged();
		}

		//void uxSanPhamDanhMucBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.SanPhamDanhMuc"/> instance.
		/// </summary>
		public Entities.SanPhamDanhMuc SelectedSanPhamDanhMuc
		{
			get {return this._currentSanPhamDanhMuc;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxSanPhamDanhMucDataGridView.VirtualMode;}
			set
			{
				this.uxSanPhamDanhMucDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxSanPhamDanhMucDataGridView.AllowUserToAddRows;}
			set {this.uxSanPhamDanhMucDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxSanPhamDanhMucDataGridView.AllowUserToDeleteRows;}
			set {this.uxSanPhamDanhMucDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxSanPhamDanhMucDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxSanPhamDanhMucDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="SanPhamDanhMucDataGridViewBase"/> class.
		/// </summary>
		public SanPhamDanhMucDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxSanPhamDanhMucDataGridView = new System.Windows.Forms.DataGridView();
			this.uxSanPhamDanhMucBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxSanPhamDanhMucErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDSanPhamDanhMucDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDSanPhamDanhMucChaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTenDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMotaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxHinhMinhHoaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTrangThaiDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxViTriDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSoLanXemDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemChinhSuaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemCapNhatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			((System.ComponentModel.ISupportInitialize)(this.uxSanPhamDanhMucDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxSanPhamDanhMucBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxSanPhamDanhMucErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxSanPhamDanhMucErrorProvider
			// 
			this.uxSanPhamDanhMucErrorProvider.ContainerControl = this;
			this.uxSanPhamDanhMucErrorProvider.DataSource = this.uxSanPhamDanhMucBindingSource;						
			// 
			// uxSanPhamDanhMucDataGridView
			// 
			this.uxSanPhamDanhMucDataGridView.AutoGenerateColumns = false;
			this.uxSanPhamDanhMucDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxSanPhamDanhMucDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDSanPhamDanhMucDataGridViewColumn,
		this.uxIDSanPhamDanhMucChaDataGridViewColumn,
		this.uxTenDataGridViewColumn,
		this.uxMotaDataGridViewColumn,
		this.uxHinhMinhHoaDataGridViewColumn,
		this.uxTrangThaiDataGridViewColumn,
		this.uxViTriDataGridViewColumn,
		this.uxSoLanXemDataGridViewColumn,
		this.uxThoiDiemChinhSuaDataGridViewColumn,
		this.uxThoiDiemCapNhatDataGridViewColumn			});
			this.uxSanPhamDanhMucDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxSanPhamDanhMucDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxSanPhamDanhMucDataGridView.Name = "uxSanPhamDanhMucDataGridView";
			this.uxSanPhamDanhMucDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxSanPhamDanhMucDataGridView.TabIndex = 0;	
			this.uxSanPhamDanhMucDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxSanPhamDanhMucDataGridView.EnableHeadersVisualStyles = false;
			this.uxSanPhamDanhMucDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnSanPhamDanhMucDataGridViewDataError);
			this.uxSanPhamDanhMucDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnSanPhamDanhMucDataGridViewCellValueNeeded);
			this.uxSanPhamDanhMucDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnSanPhamDanhMucDataGridViewCellValuePushed);
			
			//
			// uxIDSanPhamDanhMucDataGridViewColumn
			//
			this.uxIDSanPhamDanhMucDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDSanPhamDanhMucDataGridViewColumn.DataPropertyName = "IDSanPhamDanhMuc";
			this.uxIDSanPhamDanhMucDataGridViewColumn.HeaderText = "IDSanPhamDanhMuc";
			this.uxIDSanPhamDanhMucDataGridViewColumn.Name = "uxIDSanPhamDanhMucDataGridViewColumn";
			this.uxIDSanPhamDanhMucDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDSanPhamDanhMucDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDSanPhamDanhMucDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDSanPhamDanhMucChaDataGridViewColumn
			//
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.DataPropertyName = "IDSanPhamDanhMucCha";
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.HeaderText = "IDSanPhamDanhMucCha";
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.Name = "uxIDSanPhamDanhMucChaDataGridViewColumn";
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDSanPhamDanhMucChaDataGridViewColumn.ReadOnly = false;		
			//
			// uxTenDataGridViewColumn
			//
			this.uxTenDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTenDataGridViewColumn.DataPropertyName = "Ten";
			this.uxTenDataGridViewColumn.HeaderText = "Ten";
			this.uxTenDataGridViewColumn.Name = "uxTenDataGridViewColumn";
			this.uxTenDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTenDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTenDataGridViewColumn.ReadOnly = false;		
			//
			// uxMotaDataGridViewColumn
			//
			this.uxMotaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMotaDataGridViewColumn.DataPropertyName = "Mota";
			this.uxMotaDataGridViewColumn.HeaderText = "Mota";
			this.uxMotaDataGridViewColumn.Name = "uxMotaDataGridViewColumn";
			this.uxMotaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMotaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMotaDataGridViewColumn.ReadOnly = false;		
			//
			// uxHinhMinhHoaDataGridViewColumn
			//
			this.uxHinhMinhHoaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxHinhMinhHoaDataGridViewColumn.DataPropertyName = "HinhMinhHoa";
			this.uxHinhMinhHoaDataGridViewColumn.HeaderText = "HinhMinhHoa";
			this.uxHinhMinhHoaDataGridViewColumn.Name = "uxHinhMinhHoaDataGridViewColumn";
			this.uxHinhMinhHoaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxHinhMinhHoaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxHinhMinhHoaDataGridViewColumn.ReadOnly = false;		
			//
			// uxTrangThaiDataGridViewColumn
			//
			this.uxTrangThaiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTrangThaiDataGridViewColumn.DataPropertyName = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.HeaderText = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.Name = "uxTrangThaiDataGridViewColumn";
			this.uxTrangThaiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTrangThaiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTrangThaiDataGridViewColumn.ReadOnly = false;		
			//
			// uxViTriDataGridViewColumn
			//
			this.uxViTriDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxViTriDataGridViewColumn.DataPropertyName = "ViTri";
			this.uxViTriDataGridViewColumn.HeaderText = "ViTri";
			this.uxViTriDataGridViewColumn.Name = "uxViTriDataGridViewColumn";
			this.uxViTriDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxViTriDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxViTriDataGridViewColumn.ReadOnly = false;		
			//
			// uxSoLanXemDataGridViewColumn
			//
			this.uxSoLanXemDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSoLanXemDataGridViewColumn.DataPropertyName = "SoLanXem";
			this.uxSoLanXemDataGridViewColumn.HeaderText = "SoLanXem";
			this.uxSoLanXemDataGridViewColumn.Name = "uxSoLanXemDataGridViewColumn";
			this.uxSoLanXemDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSoLanXemDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSoLanXemDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemChinhSuaDataGridViewColumn
			//
			this.uxThoiDiemChinhSuaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemChinhSuaDataGridViewColumn.DataPropertyName = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.HeaderText = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Name = "uxThoiDiemChinhSuaDataGridViewColumn";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemChinhSuaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemChinhSuaDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemCapNhatDataGridViewColumn
			//
			this.uxThoiDiemCapNhatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemCapNhatDataGridViewColumn.DataPropertyName = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.HeaderText = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.Name = "uxThoiDiemCapNhatDataGridViewColumn";
			this.uxThoiDiemCapNhatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemCapNhatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemCapNhatDataGridViewColumn.ReadOnly = false;		
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxSanPhamDanhMucDataGridView);
			this.Name = "SanPhamDanhMucDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			((System.ComponentModel.ISupportInitialize)(this.uxSanPhamDanhMucErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxSanPhamDanhMucDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxSanPhamDanhMucBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				SanPhamDanhMucDataGridViewEventArgs args = new SanPhamDanhMucDataGridViewEventArgs();
				args.SanPhamDanhMuc = _currentSanPhamDanhMuc;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class SanPhamDanhMucDataGridViewEventArgs : System.EventArgs
		{
			private Entities.SanPhamDanhMuc	_SanPhamDanhMuc;
	
			/// <summary>
			/// the  Entities.SanPhamDanhMuc instance.
			/// </summary>
			public Entities.SanPhamDanhMuc SanPhamDanhMuc
			{
				get { return _SanPhamDanhMuc; }
				set { _SanPhamDanhMuc = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxSanPhamDanhMucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnSanPhamDanhMucDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxSanPhamDanhMucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnSanPhamDanhMucDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxSanPhamDanhMucDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDSanPhamDanhMucDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].IDSanPhamDanhMuc;
						break;
					case "uxIDSanPhamDanhMucChaDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].IDSanPhamDanhMucCha;
						break;
					case "uxTenDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].Ten;
						break;
					case "uxMotaDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].Mota;
						break;
					case "uxHinhMinhHoaDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].HinhMinhHoa;
						break;
					case "uxTrangThaiDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].TrangThai;
						break;
					case "uxViTriDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].ViTri;
						break;
					case "uxSoLanXemDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].SoLanXem;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].ThoiDiemChinhSua;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						e.Value = SanPhamDanhMucList[e.RowIndex].ThoiDiemCapNhat;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxSanPhamDanhMucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnSanPhamDanhMucDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxSanPhamDanhMucDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDSanPhamDanhMucDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].IDSanPhamDanhMuc = (System.Guid)e.Value;
						break;
					case "uxIDSanPhamDanhMucChaDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].IDSanPhamDanhMucCha = (System.Guid)e.Value;
						break;
					case "uxTenDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].Ten = (System.String)e.Value;
						break;
					case "uxMotaDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].Mota = (System.String)e.Value;
						break;
					case "uxHinhMinhHoaDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].HinhMinhHoa = (System.String)e.Value;
						break;
					case "uxTrangThaiDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].TrangThai = (System.Boolean)e.Value;
						break;
					case "uxViTriDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].ViTri = (System.Int32)e.Value;
						break;
					case "uxSoLanXemDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].SoLanXem = (System.Int64)e.Value;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].ThoiDiemChinhSua = (System.DateTime)e.Value;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						SanPhamDanhMucList[e.RowIndex].ThoiDiemCapNhat = (System.DateTime)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
